package com.aistar.hotel.service;


import com.aistar.hotel.entity.Hotel;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;


/**
 * Created by wubin on 2019/6/23.
 */
public interface HotelMapperService {

    @Select("select * from hotel where hotel_name like concat('%',#{hotel_name},'%')")
    List<Hotel> findAll(String hotelname);

    @Select("select * from hotel where hotel_id=#{id}")
    Hotel findById(String id);

    List<Hotel> findByany(Hotel hotel);

    @Insert("insert into hotel values(#{hotelId},#{hotelName},#{hotelRooms},#{telphone},#{hotelGrade},#{hotelInfo},#{hotelIntroduce},#{hotelPrice},#{traffic},#{hotelType},#{hotelStar},#{hotelFacilities},#{hotelWhere},#{hotelPic})")
    void save(Hotel hotel);

    @Delete("delete from hotel where hotel_id=#{id}")
    void delete(String id);

    @Update("update hotel set hotel_name=#{hotelName},hotel_rooms=#{hotelRooms} where hotel_id=#{hotelId}")
    void update(Hotel hotel);



    PageInfo<Hotel> getPageInfo(String hotelname, Integer pageNow, Integer pageSize);

}
